<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class AboutYou::SDK::Model::Image - RDoc Documentation</title>

<link href="../../../fonts.css" rel="stylesheet">
<link href="../../../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
</script>

<script src="../../../js/jquery.js"></script>
<script src="../../../js/navigation.js"></script>
<script src="../../../js/search_index.js"></script>
<script src="../../../js/search.js"></script>
<script src="../../../js/searcher.js"></script>
<script src="../../../js/darkfish.js"></script>


<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-create_from_json">::create_from_json</a>
    
    <li ><a href="#method-i-url">#url</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-AboutYou::SDK::Model::Image">
  <h1 id="class-AboutYou::SDK::Model::Image" class="class">
    class AboutYou::SDK::Model::Image
  </h1>

  <section class="description">
    
<p>This class is a represenatation of an <a href="Image.html">Image</a> model</p>

  </section>

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    
    <section class="constants-list">
      <header>
        <h3>Constants</h3>
      </header>
      <dl>
      
        <dt id="MAX_HEIGHT">MAX_HEIGHT
        
        <dd><p>max height of an image</p>
        
      
        <dt id="MAX_WIDTH">MAX_WIDTH
        
        <dd><p>max width of an image</p>
        
      
        <dt id="MIN_HEIGHT">MIN_HEIGHT
        
        <dd><p>min height of an image</p>
        
      
        <dt id="MIN_WIDTH">MIN_WIDTH
        
        <dd><p>min width of an image</p>
        
      
      </dl>
    </section>
    

    
    <section class="attribute-method-details" class="method-section">
      <header>
        <h3>Attributes</h3>
      </header>

      
      <div id="attribute-c-base_url" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">base_url</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>base image url</p>
        
        </div>
      </div>
      
      <div id="attribute-i-additional_items" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">additional_items</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Array of additional items</p>
        
        </div>
      </div>
      
      <div id="attribute-i-angle" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">angle</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Integer angle of the image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-background" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">background</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String background color of image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-color" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">color</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String color of image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-ext" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">ext</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>ext</p>
        
        </div>
      </div>
      
      <div id="attribute-i-file_size" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">file_size</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Integer file size</p>
        
        </div>
      </div>
      
      <div id="attribute-i-focus" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">focus</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String focus of the image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-gender" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">gender</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String gender of the image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-hash" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">hash</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String hash of the image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-image_size" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">image_size</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>instance of <a href="ImageSize.html">AboutYou::SDK::Model::ImageSize</a></p>
        
        </div>
      </div>
      
      <div id="attribute-i-mime_type" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">mime_type</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Integer mime type of the image</p>
        
        </div>
      </div>
      
      <div id="attribute-i-model_data" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">model_data</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Hash model data</p>
        
        </div>
      </div>
      
      <div id="attribute-i-next_detail_level" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">next_detail_level</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Integer next detail level</p>
        
        </div>
      </div>
      
      <div id="attribute-i-preparation" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">preparation</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String preparation</p>
        
        </div>
      </div>
      
      <div id="attribute-i-tags" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">tags</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Array of String tags</p>
        
        </div>
      </div>
      
      <div id="attribute-i-type" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">type</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Integer type</p>
        
        </div>
      </div>
      
      <div id="attribute-i-view" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">view</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>String View</p>
        
        </div>
      </div>
      
    </section>
    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-create_from_json" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_from_json</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for creating an instance of this class by a
json_object.</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the json_object received from the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Instance of <a href="Image.html">AboutYou::SDK::Model::Image</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_from_json-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/image.rb, line 65</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-identifier">image</span> = <span class="ruby-identifier">new</span>

  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">additional_items</span>  = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'additional_items'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'additional_items'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">angle</span>             = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'angle'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'angle'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">background</span>        = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'background'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'background'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">color</span>             = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'color'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'color'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">ext</span>               = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'ext'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'ext'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">file_size</span>         = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'size'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'size'</span>] <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">focus</span>             = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'focus'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'focus'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">gender</span>            = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'gender'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'gender'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">hash</span>              = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'hash'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'hash'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">mime_type</span>         = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'mime'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'mime'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">model_data</span>        = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'model_data'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'model_data'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">next_detail_level</span> = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'next_detail_level'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'next_detail_level'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">preparation</span>       = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'preparation'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'preparation'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">tags</span>              = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'tags'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'tags'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">type</span>              = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'type'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'type'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">view</span>              = <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'view'</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'view'</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>

  <span class="ruby-identifier">image</span>.<span class="ruby-identifier">image_size</span> = <span class="ruby-constant">ImageSize</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">json_object</span>[<span class="ruby-string">'image'</span>][<span class="ruby-string">'width'</span>]),
    <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">json_object</span>[<span class="ruby-string">'image'</span>][<span class="ruby-string">'height'</span>])
  )

  <span class="ruby-identifier">image</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-url" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">url</span><span
            class="method-args">(width = 200, height = 200)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for getting the image url for image</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>width</code> -&gt; Width of the image</p>
</li><li>
<p><code>height</code> -&gt; Height of the image</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>String url for the image</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="url-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/image.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">url</span>(<span class="ruby-identifier">width</span> = <span class="ruby-value">200</span>, <span class="ruby-identifier">height</span> = <span class="ruby-value">200</span>)
  <span class="ruby-identifier">width</span> = [[<span class="ruby-identifier">width</span>, <span class="ruby-constant">MAX_WIDTH</span>].<span class="ruby-identifier">min</span>, <span class="ruby-constant">MIN_WIDTH</span>].<span class="ruby-identifier">max</span>
  <span class="ruby-identifier">height</span> = [[<span class="ruby-identifier">height</span>, <span class="ruby-constant">MAX_HEIGHT</span>].<span class="ruby-identifier">min</span>, <span class="ruby-constant">MIN_HEIGHT</span>].<span class="ruby-identifier">max</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">base_url</span> <span class="ruby-operator">+</span> <span class="ruby-string">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hash</span> <span class="ruby-operator">+</span> <span class="ruby-string">'?width='</span> <span class="ruby-operator">+</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">width</span>) <span class="ruby-operator">+</span>
    <span class="ruby-string">'&amp;height='</span> <span class="ruby-operator">+</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">height</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>

